package com.itheima.controller;

import com.itheima.pojo.po.StockMarketIndexInfo;
import com.itheima.pojo.vo.LoginReqVo;
import com.itheima.pojo.vo.LoginRespVo;
import com.itheima.pojo.vo.R;
import com.itheima.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api")
public class UserController {
    @Autowired

    private LoginService service;

    @PostMapping("/login")
    public R<LoginRespVo> LoginController(@RequestBody LoginReqVo user) {

        R<LoginRespVo> res = service.login(user);
        System.out.println(user);
        return res;
    }

    @GetMapping("/captcha")
    public R<Map> GenerateCode() {

        System.out.println(service.GenerateCode());
        return service.GenerateCode();
    }
}
